package com.cn.jinl.service;

import com.cn.jinl.api.ISalaryService;
import com.cn.jinl.dao.SalaryMapper;
import com.cn.jinl.domain.Salary;
import com.cn.jinl.utils.CollectionsUtil;
import com.cn.jinl.utils.QueryForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class SalaryServiceImpl implements ISalaryService {

    @Autowired
    private SalaryMapper salaryMapper;

    @Override
    public List<Salary> getSalaryList(QueryForm queryForm) throws Exception {
        int count = salaryMapper.selectSalaryListCount(queryForm);
        List<Salary> result = salaryMapper.selectSalaryList(queryForm);
        if(CollectionsUtil.isNotEmpty(result)){
            result.get(0).setCount(count);
        }
        return result;
    }

    @Override
    public String addOrUpdateSalary(Salary salary) throws Exception {

        return null;
    }

}
